package com.yan;

import java.util.*;

/**
 * @author taoge
 * @Date 2024/8/1 20:06
 * @Description
 */
public class Test1 {
    public static void main(String[] args) {
        List<Student> list = new LinkedList<>();
        list.add(new Student(1 , "qwe" , 12 , "男"));
        list.add(new Student(2 , "asd" , 14 , "女"));
        list.add(new Student(3 , "zxc" , 13 , "男"));
        list.forEach(item-> System.out.println(item));
        HashMap<Integer , Student> map = new HashMap<>();
        System.out.println("----------------------------------");
        for (Student student : list) {
            map.put(student.getId() , student);
        }
        Set<Integer> keys = map.keySet();
        for (Integer keys1 : keys) {
            System.out.println(keys1 + "------" + map.get(keys1));
        }

        System.out.println("----------------------------------");
        LinkedList<Object> list2 = new LinkedList<>();
        Collection<Student> values = map.values();
        for (Student value : values) {
            list2.add(value);
        }
        list2.forEach(item-> System.out.println(item));

    }
}
